﻿@{
    Layout = null;
}
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>@ViewBag.Site.SiteTitle -- 登录</title>
    <link href="@Url.Content("~/Themes/default/easyui.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Themes/icon.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.8.0.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.easyui.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Locale/easyui-lang-zh_CN.js")" type="text/javascript"></script>
    <style type="text/css">
        #mainWrapper {width:400px;padding-top:100px;margin-right: auto;margin-left: auto;margin-top: 0;margin-bottom: 0}
        table td {
            white-space: nowrap;
          
        }
        table input,img,span {
              vertical-align:bottom;
        }
        input {
            width: 150px;
        }
    </style>
   
</head>
    <body >
        <div id="mainWrapper" style="text-align: center"  >
            <div class="easyui-panel" title="请登录" icon="icon-forward"  style="overflow:hidden;padding:15px 50px;height:230px; " collapsible="false">
                <form id="form1" method="post" action="@Url.Action("Login","Admin")">
                  
                        <table>
                            <tr>
                                <td>
                                    <label>账户:</label>
                                </td>
                                <td><input type="text" id="username" name="username"   class="easyui-validatebox" required="true" /></td>
                                <td> 
                            </tr>
                            <tr>
                            <td>
                                    <label>密码:</label>
                                </td>
                                <td><input type="password" id="password" name="password"  class="easyui-validatebox" required="true" /></td>
                                <td>
                            </tr>
                            <tr><td>
                                    <label>验证码:</label>
                                </td>
                                <td><input type="text" id="VaildCode" name="VaildCode" value=""  />
                                    <td><img title="点击刷新验证码" id="VaildCodeImg" /> 
                                </td>
                            </tr>
                            <tr><td></td><td><input type="submit" value="登录" /></td></tr>
                        </table>
                
                </form>
            </div>	    
</div>
    </body>
</html>
 <script type="text/javascript">
     $(document).ready(function () {
         $("#VaildCodeImg").attr('src', '@Url.Action("Captcha", "Admin", new { area = "Admin" })');

         $("#VaildCodeImg").click(function() {
             $(this).attr('src', '@Url.Action("Captcha", "Admin")/?' + (new Date()).getTime());

         });
         $('form').form({
             url: '',
             onSubmit: function () {

                 var isValid = $(this).form('validate');
                 if (!isValid) {
                     $.messager.progress('close'); // hide progress bar while the form is invalid
                 }
                 return isValid; // return false will stop the form submission
             }
                ,
             success: function (resultStr) {
                 var result = eval("(" + resultStr + ")");
                 if (!result.success) {
                     alert(result.msg);
                     $("#VaildCodeImg").attr('src', '@Url.Action("Captcha", "Admin")/?' + (new Date()).getTime());
                 }
                 else {
                     location.href = '@Url.Action("index", "admin")';
                 }
             }
         });


     });
    </script>